package com.cp.dao;

import com.cp.repository.AdjudgmentWord;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AdjudgmentWordMapper {



	/**
	 * class_relation_id in (7,2,8,11,1) 实例
	 * class_relation_id in (5, 3 ,17, 9, 22, 6, 10, 4) 同近义词
	 * @param convictionId
	 * @param classRelationIds
	 * @return
	 */
	@Select("SELECT * FROM adjudgment_word WHERE conviction_id = #{convictionId} AND class_relation_id IN (${classRelationIds})")
	@Results({
			@Result(id = true, property = "id", column = "id"),
			@Result(property = "content", column = "content"),
			@Result(property = "conviction", column = "conviction_id", one = @One(select="com.cp.dao.ConvictionMapper.getById")),
			//@Result(property = "adjugmentRelationWord", column = "relation_word_id", one = @One(select = "com.cp.dao.AdjudgmentRelationWordMapper.getById")),
			@Result(property = "classRelation", column = "class_relation_id", one = @One(select = "com.cp.dao.ClassRelationMapper.getById"))
	})
	List<AdjudgmentWord> getByRelationWordByConvictionIdAndClassRelationIds(@Param("convictionId") Integer convictionId, @Param("classRelationIds")String classRelationIds);



	@Select("SELECT * FROM adjudgment_word WHERE conviction_id = #{convictionId} AND class_relation_id = #{classRelationId}")
	@Results({
			@Result(id = true, property = "id", column = "id"),
			@Result(property = "content", column = "content"),
			@Result(property = "conviction", column = "conviction_id", one = @One(select="com.cp.dao.ConvictionMapper.getById")),
			//@Result(property = "adjugmentRelationWord", column = "relation_word_id", one = @One(select = "com.cp.dao.AdjudgmentRelationWordMapper.getById")),
			@Result(property = "classRelation", column = "class_relation_id", one = @One(select = "com.cp.dao.ClassRelationMapper.getById"))
	})
	List<AdjudgmentWord> getByRelationWordByConvictionIdAndClassRelationId(@Param("convictionId") Integer convictionId, @Param("classRelationId") Integer classRelationId);
}
